
import com.mysql.jdbc.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
public class MySQL {
	public static void p(){
		System.out.println("aaaaaajajaja");
	}
	public static Connection getConnection() throws SQLException, java.lang.ClassNotFoundException {
		
				Class.forName("com.mysql.jdbc.Driver");
		
				String url = "jdbc:mysql://localhost:3306/emergency";
				String username = "root";
				String password = "liuxingyu";
		
				Connection con = (Connection) DriverManager.getConnection(url, username, password);
				return con;
			}
	public  int Query(String name,String pass){
		System.out.println("111111111");
				Connection con;
				try {
					con = getConnection();
					Statement sql_statement = con.createStatement();
					String query = "select * from user where name='"+name+"' and password='"+pass+"'";
					ResultSet result = sql_statement.executeQuery(query);
					System.out.println(query);
					while(result.next()){
						System.out.println("aaa");
						return 1;
					}
				} catch (Exception e) {
					// TODO Auto-generated catch block
					return 0;
				}
				return 0;
}
	
}
